package com.vspush.udp.handle;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramPacket;
import io.netty.util.CharsetUtil;

import com.vspush.manage.MessageHeadle;
import com.vspush.udp.core.EncodeMessage;

public class ServerHeadle extends SimpleChannelInboundHandler<DatagramPacket> {

	@Override
	protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg)throws Exception {
     		String received = msg.content().toString(CharsetUtil.UTF_8);
     		EncodeMessage  em = new EncodeMessage(received);
     		MessageHeadle mh = em.getMessageHeadle();
     		mh.headle(ctx,msg);
	}

}
